using AiQiuQuan.Sport.Model.Models;
using AiQiuQuan.Sport.Core;
using AiQiuQuan.Sport.WebApi.Services;
using Microsoft.AspNetCore.Mvc;

namespace AiQiuQuan.Sport.WebApi.Controllers
{
    /// <summary>
    /// 活动、约球、比赛订单管理
    /// </summary>
    public class GameOrderController : ApiController
    {
        private readonly IGameOrderService _gameOrderService;

        /// <summary>
        /// ctor
        /// </summary>
        public GameOrderController(
            IGameOrderService gameOrderService)
        {
            _gameOrderService = gameOrderService;
        }

        /// <summary>
        /// 分页查询
        /// </summary>
        [HttpPost("pagelist")]
        public async Task<UnaryResult<PageResult<GameOrderDto>>> PageListAsync(GameOrderPageRequestDto request)
        {
            var result = await _gameOrderService.PageListAsync(request);
            return UnaryResult.Succeed(result);
        }

        /// <summary>
        /// 比赛活动订单详情
        /// </summary>
        /// <param name="id">订单ID</param>
        [HttpGet("get")]
        public async Task<UnaryResult<GameOrderDto>> GetAsync(Guid id)
        {
            var result = await _gameOrderService.GetAsync(id);
            return UnaryResult.Succeed(result);
        }
    }
}
